﻿package com.test.clyq.entity;

import java.util.Set;

import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;

import com.test.entity.Item;
import com.test.json.JsonUtil;

/**
 * 内容信息. <br>
 * 内容信息实体.
 * <p>
 * Copyright: Copyright (c) 2010-4-16 下午04:58:48
 * <p>
 * Company: 北京宽连十方数字技术有限公司
 * <p>
 * Author: liuxl@c-platform.com
 * <p>
 * Version: 1.0
 * <p>
 */
public class EntityItem implements Item {

	/** serialVersionUID */
	private static final long serialVersionUID = 1186048164771L;

	/** 被访问的次数 */
	private Integer browseCount = 0;

	/** 栏目 */
	// private Category category;
	/** 所属栏目 是否推荐 0否 1是 */
	private Integer categoryFirst = 0;

	/** 存储栏目ID */
	private Long entityCategoryId;

	/** 实际内容 */
	private String entityContent;

	/** 创建时间 */
	private String entityCreatetime;

	/** 描述(摘要) */
	private String entityTaoBaoId;

	/** 主图URL */
	private String entityImgUrl;


	/** 标识ID */
	private Long entityItemId;

	/** 内容名称 */
	private String entityName;

	/** 内容状态(0:已删除,1:未删除) */
	private Long entityStatus = 1L;

	/** 内容类型 1：图片文章 2：视频文章 3：文字文章 */
	private Integer entityType = 3;
	
	/** 详细页面url*/
	private String detailUrl;
	
	
	/** 淘宝客详细页面url*/
	private String convertUrl;
	/** 价格*/
	private String price;
	
	/**商品图片组图*/
	private String entityImgs;

	public String getConvertUrl() {
		return convertUrl;
	}

	public void setConvertUrl(String convertUrl) {
		this.convertUrl = convertUrl;
	}

	public Long getEntityItemId() {
		return entityItemId;
	}

	public void setEntityItemId(Long entityItemId) {
		this.entityItemId = entityItemId;
	}

	public String getDetailUrl() {
		return detailUrl;
	}

	public void setDetailUrl(String detailUrl) {
		this.detailUrl = detailUrl;
	}

	public String getPrice() {
		return price;
	}

	public void setPrice(String price) {
		this.price = price;
	}

	public String getEntityImgs() {
		return entityImgs;
	}

	public void setEntityImgs(String entityImgs) {
		this.entityImgs = entityImgs;
	}

	public Integer getBrowseCount() {
		return browseCount;
	}

	public Integer getCategoryFirst() {
		return categoryFirst;
	}

	public Long getEntityCategoryId() {
		return entityCategoryId;
	}

	public String getEntityContent() {
		return this.entityContent;
	}

	public String getEntityCreatetime() {
		return this.entityCreatetime;
	}


	public String getEntityImgUrl() {
		return this.entityImgUrl;
	}

	public String getEntityName() {
		return this.entityName;
	}

	public Long getEntityStatus() {
		return this.entityStatus;
	}

	public Integer getEntityType() {
		return entityType;
	}

	public Long getId() {
		return this.entityItemId;
	}


	public void setBrowseCount(Integer browseCount) {
		this.browseCount = browseCount;
	}

	// public void setCategory(Category category) {
	// this.category = category;
	// }

	public void setCategoryFirst(Integer categoryFirst) {
		this.categoryFirst = categoryFirst;
	}

	public void setEntityCategoryId(Long entityCategoryId) {
		this.entityCategoryId = entityCategoryId;
	}

	public void setEntityContent(String entityContent) {
		this.entityContent = entityContent;
	}

	public void setEntityCreatetime(String entityCreatetime) {
		this.entityCreatetime = entityCreatetime;
	}


	public String getEntityTaoBaoId() {
		return entityTaoBaoId;
	}

	public void setEntityTaoBaoId(String entityTaoBaoId) {
		this.entityTaoBaoId = entityTaoBaoId;
	}

	public void setEntityImgUrl(String entityImgUrl) {
		this.entityImgUrl = entityImgUrl;
	}


	public void setEntityName(String entityName) {
		this.entityName = entityName;
	}

	public void setEntityStatus(Long entityStatus) {
		this.entityStatus = entityStatus;
	}

	public void setEntityType(Integer entityType) {
		this.entityType = entityType;
	}

	public void setId(Long id) {
		this.entityItemId = id;
	}

	public String toJSON() {

		return JsonUtil.getJsonStringFromObject(this);
	}

	public String toXML() {
		Document doc = DocumentHelper.createDocument();
		Element root = doc.addElement("items");
		root.addElement("i").addAttribute("n", "主键").setText(String.valueOf(this.entityItemId != null ? this.entityItemId : ""));
		root.addElement("i").addAttribute("n", "内容状态").setText(this.entityStatus != null && this.entityStatus == 1 ? "正常" : "删除");

		root.addElement("i").addAttribute("n", "内容名称").setText(this.entityName != null ? this.entityName : "");
		root.addElement("i").addAttribute("n", "实际内容").setText(this.entityContent != null ? this.entityContent : "");
		root.addElement("i").addAttribute("n", "创建时间").setText(String.valueOf(this.entityCreatetime != null ? this.entityCreatetime : ""));

		return doc.asXML();
	}

}